#ifndef TABWIDGET_H
#define TABWIDGET_H

#include <QTabWidget>
#include "logic/dataDefination.h"

class ChatingTab;
class ContactListTab;

class TabWidget : public QTabWidget
{
    Q_OBJECT
public:
    explicit TabWidget(QWidget *parent = 0);

public:
    void updateContactList(const QList<userInfo> &contactList);
    void updateMessage(const QString &ip, const QList<recordInfo> &messageList);

signals:
    void sendMessage(const QString &ip, const QString &message);
    void stopChating(const QString &ip);

public slots:
    void openChatingTab(const QString &ip);
    void closeChatingTab(int index);
    void onCurrentTabChanged(int newIndex);

private:
    ChatingTab * findChatingTabByIp(const QString &ip);
    ChatingTab * createChatingTab(const QString &ip);

private:
    ContactListTab *mContactListTab;
};
#endif // TABWIDGET_H
